package cn.iocoder.yudao.module.student.dal.mysql.student;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.student.controller.app.student.vo.WebStudentExportReqVO;
import cn.iocoder.yudao.module.student.controller.app.student.vo.WebStudentInfoRespVO;
import cn.iocoder.yudao.module.student.controller.app.student.vo.WebStudentPageReqVO;
import cn.iocoder.yudao.module.student.dal.dataobject.student.WebStudentDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 学生管理 Mapper
 *
 * @author 周枫皓
 */
@Mapper
public interface WebStudentMapper extends BaseMapperX<WebStudentDO> {

    default PageResult<WebStudentDO> selectPage(WebStudentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WebStudentDO>()
                .eqIfPresent(WebStudentDO::getId, reqVO.getId())
                .likeIfPresent(WebStudentDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(WebStudentDO::getStatus, reqVO.getStatus())
                .eqIfPresent(WebStudentDO::getMobile, reqVO.getMobile())
                .eqIfPresent(WebStudentDO::getInJobTime, reqVO.getInJobTime())
                .eqIfPresent(WebStudentDO::getJobStatus, reqVO.getJobStatus())
                .orderByDesc(WebStudentDO::getId));
    }

    default List<WebStudentDO> selectList(WebStudentExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WebStudentDO>()
                .eqIfPresent(WebStudentDO::getId, reqVO.getId())
                .likeIfPresent(WebStudentDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(WebStudentDO::getStatus, reqVO.getStatus())
                .eqIfPresent(WebStudentDO::getMobile,reqVO.getMobile())
                .orderByDesc(WebStudentDO::getId));
    }

    List<WebStudentInfoRespVO> getStudentInfoList1(@Param("pageNo") Integer pageNo, @Param("pageSize") Integer pageSize);

}
